<?php
if (!user()->isGuest && user()->id) {
    ?>
    <div class="title"><?php echo h(user()->getModel()->username, 20); ?></div>
    <div class="text-box">
        <div class="left-info-box">
    	<img class="img-avatar" src="<?php echo user()->getModel()->getAvatarUrl('large') ?>"/>    	
	    <?php
	    if (user()->getModel()->status == User::STATUS_WAITING_ACTIVE) {
		?>
		<div class="alert alert-danger">Your account still hasn't been approved.</div>
		<?php
	    }
	    ?>
        </div>
        <div class="right-info-box">	    
	    <?php
	    ////get all request
	    //get number of accept
	    $numOfAccept = Friend::getAcceptFriend(user()->id);
	    //get number of request
	    $numOfRequested = FriendRequest::getFriendRequest(user()->id);
	    $totalRequest = $numOfAccept + $numOfRequested;
	    ?>

    	<ul>

    	    <li>

    		<div><i class="icon-th-list"></i><a href='<?php echo SITE_NAME_URL ?>dashboard'>Dashboard</a></div> 
    		<div class='right-menu-profile'>
    		    <img class='img-icon' src='<?php echo WWW_URL ?>images/icon-group.png'/>
    		    <a style="margin-left: -1px;"
			<?php if (user()->getModel()->status == User::STATUS_WAITING_ACTIVE) { ?>
			       class="show-form-post" href="#alert-not-active"
			   <?php } else { ?>
			       href='<?php echo SITE_NAME_URL ?>friend/find_friend'
			   <?php } ?>
    		       >Friends <span class='btn btn-danger number-notify' id='num-friend' <?php
			       if ($totalRequest <= 0)
				   echo "style='display:none;'";
			       ?>><?php echo $totalRequest ?></span></a>
    		</div> 
    		<div class='clear'></div>
    	    </li>

    	    <li>
    		<div><i class="icon-user"></i><a href="<?php echo SITE_NAME_URL ?>user/update">Profile</a></div>
    		<div><i class="icon-list-alt"></i><a href='<?php echo SITE_NAME_URL ?>my_post'>My Posts</a></div>
    		<div class='clear'></div>
    	    </li>
    	    <li>
    		<div><i class="icon-envelope"></i><a 
			<?php if (user()->getModel()->status == User::STATUS_WAITING_ACTIVE) { ?>
				class="show-form-post" href="#alert-not-active"
			    <?php } else { ?>
				href="<?php echo SITE_NAME_URL ?>mailbox/message/"
			    <?php } ?>
    			>Messages</a></div>
    		<div class="menu-item-logout"><i class="icon-off"></i><a href="<?php echo SITE_NAME_URL ?>site/logout">Log out</a></div>    		
    	    </li>    	    
    	</ul>
        </div>
    </div>

    <?php
} else {
    include '_form.php';
}?>